import axios from 'axios'

export function getListAPI(params) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'GET',
    params
  })
}

export function addAPI(data) {
  return axios({
    url: 'http://localhost:3001/data',
    method: 'POST',
    data
  })
}

export function getDetailAPI(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`
  })
}

export function updateDetailAPI(data) {
  return axios({
    url: `http://localhost:3001/data/${data.id}`,
    method: 'PUT',
    data
  })
}

export function delAPI(id) {
  return axios({
    url: `http://localhost:3001/data/${id}`,
    method: 'DELETE'
  })
}

export function searchAPI(name) {
  return axios({
    url: `http://localhost:3001/data/?name=${name}`
  })
}
